#include<iostream>
#include<algorithm>
#include<memory.h>
using namespace std;
int main()
{
	int n;
	while (cin >> n)
	{
		int dp[10010] = {0};
		for (int i = 2; i < n+2; i++)
		{
			int x;
			cin >> x;
			dp[i] = max(dp[i - 2] + x, dp[i - 1]);
		}
		cout << dp[n + 1]<<endl;
	}
	return 0;
}